package com.dzu.easy;

/**
 * @author ZhaoDong
 * @date 2022/11/8 10:10
 * @description 326. 3 的幂
 */
public class Test326 {

    public boolean isPowerOfThree2(int n) {
        return n > 0 && 1162261467 % n == 0;
    }



    public boolean isPowerOfThree(int n) {
        if (n < 1) {
            return false;
        }
        while (n % 3 == 0) {
            n /= 3;
        }
        return n == 1;
    }

}
